describe("Double", function() {
  var func = isDigital;
  it("对小数点的判断", function() {
    var input = null;
    var output = null;
    expect(func(input)).toBe(null);

    var input = "1.0";
    var output = input;
    expect(func(input)).toMatch(output);

    var input = "1.011111";
    var output = "1.01";
    expect(func(input)).toMatch(output);
  });

  it("小数点只能出现一次", function() {
    var input = "1.01.1.111";
    var output = null;
    expect(func(input)).toBe(output);

    var input = "1.01.1.11.1";
    var output = null;
    expect(func(input)).toBe(output);
  });

  it("如果有符号，小数点只能出现在符号后，并且除了符号和小数点，至少得有一位数字", function() {
    var input = ".-1233";
    var output = null;
    expect(func(input)).toBe(output);

    var input = "-1212.012212";
    var output = input;
    expect(func(input)).toMatch(output);

    var input = "-1212";
    var output = input;
    expect(func(input)).toMatch(output);

    var input = "-.";
    var output = null;
    expect(func(input)).toBe(output);

    var input = "-1212.0-12212";
    var output = null;
    expect(func(input)).toBe(output);

    var input = "1212.0-12212";
    var output = null;
    expect(func(input)).toBe(output);

    var input = "-.1233";
    var output = input;
    expect(func(input)).toMatch(output);
  });
});
